<?php
namespace Admin\Controller;
use Think\Controller;
class CountController extends CommonController {
    public function index(){
    	$time = strtotime("-7 days");

    	echo strtotime(date('Y-m-d',$time));

    	$sql = "select count(id) cn,FROM_UNIXTIME(create_time,'%Y-%m-%d') cdate from user  GROUP BY cdate";

    	$data = M()->query($sql);

    	$cn = array();
    	$cdate = array();
    	foreach ($data as $v) {
    		$cn[] = $v['cn'];
    		$cdate[] = $v['cdate'];
    	}

    	$cn = implode(',', $cn);

    	$cdate = implode('","', $cdate);
    	var_dump($cn,$cdate);

    	$this->assign('cn',$cn);
    	$this->assign('cdate',$cdate);
        $this->display();
    }

    public function reg()
    {
    	$sql = "select count(id) cn,FROM_UNIXTIME(create_time,'%Y-%m-%d') cdate from user  GROUP BY cdate";

    	$data = M()->query($sql);

    	echo json_encode($data);
    }
}